export default {
	//首页时间转化
	dateTime(S) {
		let old = new Date(S);
		let now = new Date();
		//获取old时间戳
		let d = old.getTime();
		let h = old.getHours();
		let m = old.getMinutes();
		let y = old.getFullYear();
		let M = old.getMonth()+1;
		let D = old.getDate();
		//获取new时间戳
		let nd = now.getTime();
		let nh = now.getHours();
		let nm = now.getMinutes();
		let ny = now.getFullYear();
		let nM = now.getMonth()+1;
		let nD = now.getDate();

		//当天的时间
		if (D === nD && y === ny && M === nM) {
			if (h < 10) {
				h = '0' + h;
			}
			if (m < 10) {
				m = '0' + m
			}
			return h + ":" + m
		}
		//前天时间
		if (D + 1 === nD && y === ny && M === nM) {
			if (h < 10) {
				h = '0' + h;
			}
			if (m < 10) {
				m = '0' + m
			}
			return '前天' + h + ':' + m
		} else {
			return y + "/" + M + '/' + D;
		}
	}
}
